using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;
using System.Threading;
namespace mmq.MasterPages
{
    public partial class Grey : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string UserCulture = HttpContext.Current.Profile.GetPropertyValue("PreferredCulture").ToString();
            if (UserCulture == "en-US")
            {
                hyLink_Chinese.Visible = true;
            }
            else
            {
                hyLink_Chinese.Visible = false;
            }
            this.hyLink_English.Visible = !hyLink_Chinese.Visible;
        }

        protected void hyLink_English_Click(object sender, EventArgs e)
        {
            HttpContext.Current.Profile.SetPropertyValue("PreferredCulture", "en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
            Response.Redirect(Request.Url.LocalPath);
        }

        protected void hyLink_Chinese_Click(object sender, EventArgs e)
        {
            HttpContext.Current.Profile.SetPropertyValue("PreferredCulture", "zh-CN");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN");
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("zh-CN");
            Response.Redirect(Request.Url.LocalPath);
        }
    }
}
